import { debounce } from './utils'

import BackTop from "components/content/backTop/BackTop";
export const mixins = {
  data(){
    return {
      itemImgsListen: null
    }
  },
  mounted() {
    // 图片加载完的事件监听
    console.log(this.$refs)
    const refresh = debounce(this.$refs.scrollview.scrollRefresh, 500);
    this.itemImgsListen = () => {
      console.log('hello')
      refresh();
    }
    // this.$bus.$on("imgLoaded", this.itemImgsListen);
    // 获取tab-control组件的offsetTOp
    // console.log(this.$refs.tabControl2.$el.offsetTop)
    // if()
  },
}

export const backTopMixin = {
  data(){
    return {
      isShowBackTop: false,
    }
  },
  methods: {
    backClick() {
      this.$refs.scrollview.scrollTo(0, 0, 500);
    },
    listenShowBackTop(position){
      this.isShowBackTop = -position.y > 1000;
    }
  },
  components:{
    BackTop,
  }
}